package org.stvd.repository.admin.impl;

import java.util.List;

import org.springframework.stereotype.Repository;
import org.stvd.core.dto.QueryResult;
import org.stvd.entities.admin.Params;
import org.stvd.repository.admin.ParamsDao;
import org.stvd.repository.base.impl.BaseDaoImpl;

@Repository("ParamsDao")
public class ParamsDaoImpl extends BaseDaoImpl<Params> implements ParamsDao {

    @Override
    public List<Params> findAll(String guid) {
        return findByHQL("from Params where guid = ?0 or paramType = '1'", guid); 
    }

    @Override
    public List<Params> findByParamName(String guid, String paramName) {
        return findByHQL("from Params where (guid = ?0 or paramType = '1') and paramName = ?1", guid, paramName); 
    }
    
    public QueryResult<Params> getParamQueryResult(int start, int limit, String paramName, String guid){
        return super.getQueryResultByHQL(start, limit, "from Params where (guid = ?0 or paramType = '1') and paramName like ?1", guid, "%"+paramName+"%");
    }
}
